`define DELAY(N, clk) begin 	repeat(N) @(posedge clk);	#1ps;end

module testbench();

//-------------------------------------{{{common cfg
timeunit 1ns;
timeprecision 1ps;
initial $timeformat(-9,3,"ns",6);

string tc_name;
int tc_seed;

initial begin
    if(!$value$plusargs("tc_name=%s", tc_name)) $error("no tc_name!");
    else $display("tc name = %0s", tc_name);
    if(!$value$plusargs("ntb_random_seed=%0d", tc_seed)) $error("no tc_seed");
    else $display("tc seed = %0d", tc_seed);
end
//-------------------------------------}}}

//-------------------------------------{{{clk/rst cfg
logic clk, rst_n;
initial forever #5ns clk = ~clk;
initial begin
    rst_n = 1'b0;
	`DELAY(30, clk);
	rst_n = 1'b1;
end
initial begin
    #100000ns $finish;
end
//-------------------------------------}}}

//-------------------------------------{{{other sig assign
initial begin
    `DELAY(50, clk);
end

//-------------------------------------}}}

logic [31:0]ch_wave;
integer file = $fopen("../script/gogogo.cfg","r");
initial begin
  `DELAY(10, clk);
  while(!$feof(file))begin
      bit[32-1:0] value;
      $fscanf(file, "%b\n", value);
      //ch_wave = 'x & value;
      ch_wave = value;
      `DELAY(1, clk);
  end
  `DELAY(10, clk);
  $finish;
end

endmodule
